#include<bits/stdc++.h>
using namespace std;
signed main() {
	int n, k;
	cin >> n >> k;
	vector<int> vec;
	while (cin >> n) {
		vec.push_back(n);
	}
	sort(vec.begin(), vec.end(), greater<int>());

	int sum = 0;
	for (int i = 0; i < vec.size(); i++) {
		sum += vec[i];
		if (sum >= k) {
			cout << i + 1;
			return 0;
		}
	}
	return 0;
}
